import  React,{Component} from 'react'
import { Editor } from '@tinymce/tinymce-react';
import '../../../../static/css/article.less'

class ArticleEdit extends Component{
    constructor(props) {
        super(props);
        this.state={'content':''}
    }
    componentDidMount() {
        //document.title='文章更改'
        document.title= '文章创作'
    }
    render() {
        const handleEditorChange = (content, editor) => {
            console.log('Content was updated:', content);
            // setContent(content);
            this.setState('content',content)
        };
        return　(
            <div>
                edit
                <div className="editorForm">
                    <Editor
                        init={{
                            height: 500,
                            language:'zh_CN',
                            plugins: [
                                'advlist autolink lists link image charmap print preview anchor',
                                'searchreplace visualblocks code fullscreen',
                                'insertdatetime media table paste code help wordcount',
                            ],
                            toolbar:
                            // eslint-disable-next-line no-multi-str
                                'undo redo | formatselect |fontselect fontsizeselect | bold italic backcolor forecolor | \
                           alignleft aligncenter alignright alignjustify | \
                           bullist numlist outdent indent | removeformat | help',
                        }}
                        onEditorChange={handleEditorChange}
                    />
                </div>
            </div>
        )
    }
}

export default ArticleEdit
